from pom.mainActivity import MainActivity
from pom.traggleActivity import TraggleActivity
from pom.loginActivity import LoginActivity
from common.tools import get_token

class User:
    def __init__(self):
        self.mainAct = MainActivity()
        self.traggleAct = TraggleActivity()
        self.loginAct = LoginActivity()


    def login(self,token):
        """
        用户登录操作
        :param token:
        :return:
        """
        access_token = get_token(token)
        self.mainAct.troggle_btn.click()
        self.traggleAct.avatar_btn.click()
        self.loginAct.token_area.send_keys(access_token)
        self.loginAct.login_btn.click()

    def swipe_left(self):
        self.loginAct.swipe('left')

    def get_login_result(self):
        """
        获取用户登录之后的结果
        :return:
        """
        return self.loginAct.get_Toast.text



